<?php

class Admin_Model_DbTable_Matricebr extends Zend_Db_Table {
    protected $_name = 'matricebr';
    /**
		Recupererle point de la muraille par son id
     */
    public function getTerrain($idterrain) {
        $idterrain = (int)$idterrain;
        $row = $this->fetchRow('id = ' . $idterrain);
        if (!$row) {
            throw new Exception("Count not find row $idterrain");
        }
        return $row->toArray();    
    }
    
    public function addTerrain($matricule) {
        $data = array(
            'matricule' => $matricule,
        );
        $this->insert($data);
    }
    
    public function updateTerrain($idterrain, $matricule) {
         $data = array(
            'matricule' => $matricule,
        );
        $this->update($data, 'idterrain = '. (int)$idterrain);
    }
    
	function deleteTerrain($idpointgmv) {
		$this->delete ( 'idterrain =' . ( int ) $idterrain );
	}
    /**
     * 
     * @return  
     */
    public function getAllTerrain() {    
        $all = $this->fetchAll();
        $terrains = array();
        $terrains['total'] = count($all->toArray());
        $terrains['rows'] = $all->toArray();
        return $terrains ;
    }    
    
}
